import json

filename = 'username.json'
def get_user():
    try:
        with open(filename) as f_obj:
            username = json.load(f_obj)
    except FileNotFoundError:
        return None
    else:
        return username

def user_do():
    username = get_user()
    if username:
        print('welcom back'+username)
    else:
        username = input('what is name?')
        with open(filename, 'w') as f_obj:
            json.dump(username, f_obj)
            print('you are regist success')

user_do()



